<template>
    <view class="home-contirner">
        <u-search placeholder="请输入动作名称" v-model="fromData.actionName" :show-action="false"></u-search>
        <u-dropdown ref="dropdown">
            <u-dropdown-item title="排序方式" :options="sortOptions" v-model="fromData.sortType"></u-dropdown-item>
            <u-dropdown-item title="所属分类">
                <view class="slot-content">
                    <view class="u-text-center u-content-color u-m-t-20 u-m-b-20">其他自定义内容</view>
                    <u-button type="primary" @click="closeDropdown">确定</u-button>
                </view>
            </u-dropdown-item>
        </u-dropdown>

    </view>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import config from '../../../config/index'

const dataList = ref([]);
const sortOptions = [
    {
        label: '默认排序',
        value: 1,
    },
    {
        label: '创建时间排序',
        value: 2,
    }
]
const dropdown = ref();
const closeDropdown = () => {
    dropdown.value.close();
}

const fromData = ref({
    categoryId: [],
    sortType: 1,
    actionName: '',
    pageNo: 1,
    pageSize: 10
})

const getDataList = async () => {
    const resp = await uni.request({
        url: `${config.baseUrl}/action/page`,
        method: 'post',
        data: fromData.value,
    })
    dataList.value = resp.data.data.records
}

onMounted(() => {
    getDataList();
})
</script>

<style lang="scss" scoped>
.home-contirner {
    margin: 10rpx;

}
</style>